#import "wooddoc.h"

@implementation WoodDoc (Private)

- makeAddTree:aTree
{
	if(!aTree || (tree && !lastSelectedNode))
		return self;
	[aTree setDelegateRecursive:self];
	if(!tree){
		tree = aTree;
		[self declareSelection:aTree];
		[undoManager setUndoName:"Addition"];
		[undoManager setRedoName:"Deletion"];
		[[undoManager setUndoTarget:self] makeDeleteTree:aTree];
		[self updateViewsDirty:YES rect:NULL flag:(UPDATE_ALL | SCROLL_TREEVIEW)];
	} else  
		[lastSelectedNode addTree:aTree];		
	[[NXApp inspectorManager] revert:self];
	[self setEmpty:NO];
	return self;
}

- makeAddOOETree:aTree
{
	if(!aTree)
		return self;
	if(tree)
		[tree free];
	[aTree setDelegateRecursive:self];
	tree = aTree;
	[self declareSelection:aTree];
	[self updateViewsDirty:NO rect:NULL flag:(UPDATE_ALL | SCROLL_TREEVIEW)];		
	[[NXApp inspectorManager] revert:self];
	[self setEmpty:NO];
	return self;
}

	
- makeDeleteTree:aTree
{
	[self declareSelection:aTree];
	[self delete:self];
	return self;
}

@end
